﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using pdtransport_v2._0.Areas.back.Models;
using System.IO;

namespace pdtransport_v2._0.Areas.back.Controllers
{
    public class uploadHinhController : Controller
    {
        //
        // GET: /back/uploadHinh/

        //Tham khảo http://karlmendes.com/2010/07/image-uploading-in-asp-net-mvc/

        [HttpPost]
        public void Upload(IEnumerable<HttpPostedFileBase> files)
        {
            foreach (var file in files)
            {
                if (file.ContentLength > 0)
                {
                    var fileName = Path.GetFileName(file.FileName);
                    var path = Path.Combine(Server.MapPath("~/Content/images"), fileName);
                    file.SaveAs(path);
                }
            }
        }

        // hết tham khảo http://karlmendes.com/2010/07/image-uploading-in-asp-net-mvc/

    }
}
